package Method_References;

import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class number7 {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		System.out.println("请输入任意字符串：");
		String inputstr = sc.next();

		System.out.println("请再次输入任意字符串：");
		String inputstr1 = sc.next();

		// 统计第一个字符串中字符出现的次数
		Map<Character, Long> map1 = inputstr.chars().mapToObj(c -> (char) c).collect(HashMap::new,
				(m, c) -> m.merge(c, 1L, Long::sum), HashMap::putAll);

		// 统计第二个字符串中字符出现的次数
		Map<Character, Long> map2 = inputstr1.chars().mapToObj(c -> (char) c).collect(HashMap::new,
				(m, c) -> m.merge(c, 1L, Long::sum), HashMap::putAll);

		// 计算两个字符串中字符出现次数的差值
		long difference = map1.entrySet().stream()
				.mapToLong(entry -> Math.max(entry.getValue() - map2.getOrDefault(entry.getKey(), 0L), 0L)).sum();

		// 输出结果
		System.out.println(difference == 0 ? "NO" : "YES " + difference);
	}
}
